package com.yuanthink.gwt.client.workplace;

import com.extjs.gxt.ui.client.data.ModelData;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.MessageBox;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.ui.Frame;
import com.yuanthink.gwt.client.actions.IAction;
import com.yuanthink.gwt.client.eventbus.EventBus;
import com.yuanthink.gwt.client.registry.GeneralRegistry;
/**
 * 
 * @author 06peng
 *
 */
public class DefaultAction implements IAction {
    EventBus eventBus;

    public DefaultAction(EventBus eventBus) {
        this.eventBus = eventBus;
    }

	@SuppressWarnings("deprecation")
	public void execute(ModelData data) {
		ContentPanel container = (ContentPanel) GeneralRegistry.get("mainArea");
		if (container == null) {
			MessageBox.alert("Debug information", "container==null", null);
			return;
		}
		container.removeAll();
		container.setLayout(new FitLayout());
		Frame mainFrame = new Frame("../OurHome/modules/core/main.jsp");
		mainFrame.removeStyleName(mainFrame.getStyleName());
		DOM.setIntAttribute(mainFrame.getElement(), "frameBorder", 0);
		container.add(mainFrame);

		container.layout();

	}

    public boolean shouldAddToHistory() {
        return true;  
    }
}